package com.hualan.domain;

import java.io.Serializable;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 文章表，存储所有文章信息
 * @TableName article
 */
@Data
public class Article implements Serializable {
    /**
     * 主键，自增
     */
    private Long id;

    /**
     * 文章名
     */
    private String articlename;

    /**
     * 文章简介
     */
    private String articleintroduce;

    /**
     * 咨询师id，外键关联teacher表
     */
    private Long teacherId;

    /**
     * 列表图，存储URL网址
     */
    private String tabularchart;

    /**
     * 详情内容，用于存储富文本编辑器的内容
     */
    private String details;

    /**
     * 阅读量
     */
    private Integer readquantity;

    /**
     * 收藏量
     */
    private Integer collects;

    /**
     * 
     */
    private Long typeId;

    /**
     * 创建时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = " yyyy-mm-dd hh-mm-ss")
    private Date createtime;

    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Article other = (Article) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getArticlename() == null ? other.getArticlename() == null : this.getArticlename().equals(other.getArticlename()))
            && (this.getArticleintroduce() == null ? other.getArticleintroduce() == null : this.getArticleintroduce().equals(other.getArticleintroduce()))
            && (this.getTeacherId() == null ? other.getTeacherId() == null : this.getTeacherId().equals(other.getTeacherId()))
            && (this.getTabularchart() == null ? other.getTabularchart() == null : this.getTabularchart().equals(other.getTabularchart()))
            && (this.getDetails() == null ? other.getDetails() == null : this.getDetails().equals(other.getDetails()))
            && (this.getReadquantity() == null ? other.getReadquantity() == null : this.getReadquantity().equals(other.getReadquantity()))
            && (this.getCollects() == null ? other.getCollects() == null : this.getCollects().equals(other.getCollects()))
            && (this.getTypeId() == null ? other.getTypeId() == null : this.getTypeId().equals(other.getTypeId()))
            && (this.getCreatetime() == null ? other.getCreatetime() == null : this.getCreatetime().equals(other.getCreatetime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getArticlename() == null) ? 0 : getArticlename().hashCode());
        result = prime * result + ((getArticleintroduce() == null) ? 0 : getArticleintroduce().hashCode());
        result = prime * result + ((getTeacherId() == null) ? 0 : getTeacherId().hashCode());
        result = prime * result + ((getTabularchart() == null) ? 0 : getTabularchart().hashCode());
        result = prime * result + ((getDetails() == null) ? 0 : getDetails().hashCode());
        result = prime * result + ((getReadquantity() == null) ? 0 : getReadquantity().hashCode());
        result = prime * result + ((getCollects() == null) ? 0 : getCollects().hashCode());
        result = prime * result + ((getTypeId() == null) ? 0 : getTypeId().hashCode());
        result = prime * result + ((getCreatetime() == null) ? 0 : getCreatetime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", articlename=").append(articlename);
        sb.append(", articleintroduce=").append(articleintroduce);
        sb.append(", teacherId=").append(teacherId);
        sb.append(", tabularchart=").append(tabularchart);
        sb.append(", details=").append(details);
        sb.append(", readquantity=").append(readquantity);
        sb.append(", collects=").append(collects);
        sb.append(", typeId=").append(typeId);
        sb.append(", createtime=").append(createtime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}